package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.KeyAdapter;

import javabean.JPanelImagen;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;

import javax.swing.WindowConstants;
import javax.swing.event.MenuKeyEvent;
import javax.swing.event.MenuKeyListener;
import javax.swing.SwingUtilities;

import controlador.ControladorPrincipalJuego;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaMenu extends javax.swing.JFrame {
	private JPanelImagen Fondo;
	private JMenuBar jMenuBar1;
	private JMenuItem jMenuItem8;
	private JMenuItem jMenuItem9;
	private JMenu jMenu3;
	private JMenuItem jMenuItem7;
	private JMenuItem jMenuItem6;
	private JMenuItem jMenuItem5;
	private JMenu jMenu2;
	private JMenuItem jMenuItem4;
	private JMenuItem jMenuItem3;
	private JMenuItem jMenuItem2;
	private JMenuItem jMenuItem1;
	private JMenu jMenu1;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				VentanaMenu inst = new VentanaMenu();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public VentanaMenu() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Menu Buscaminas");
			getContentPane().setBackground(new java.awt.Color(255,255,255));
			{
				jMenuBar1 = new JMenuBar();
				setJMenuBar(jMenuBar1);
				jMenuBar1.setFont(new java.awt.Font("Bitstream Charter",1,14));
				jMenuBar1.setBackground(new java.awt.Color(173,216,230));
				{
					jMenu1 = new JMenu();
					jMenuBar1.add(jMenu1);
					jMenu1.setText("Juego");
					{
						jMenuItem1 = new JMenuItem();
						jMenu1.add(jMenuItem1);
						jMenuItem1.setText("Principiante");
						jMenuItem1.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jMenuItem1ActionPerformed(evt);
							}
						});
					}
					{
						jMenuItem2 = new JMenuItem();
						jMenu1.add(jMenuItem2);
						jMenuItem2.setText("Intermedio");
						jMenuItem2.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jMenuItem2ActionPerformed(evt);
							}
						});
					}
					{
						jMenuItem3 = new JMenuItem();
						jMenu1.add(jMenuItem3);
						jMenuItem3.setText("Avanzado");
						jMenuItem3.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jMenuItem3ActionPerformed(evt);
							}
						});
					}
					{
						jMenuItem4 = new JMenuItem();
						jMenu1.add(jMenuItem4);
						jMenuItem4.setText("Personalizado");
						
					}
				}
				{
					jMenu2 = new JMenu();
					jMenuBar1.add(jMenu2);
					jMenu2.setText("Consultas");
					{
						jMenuItem5 = new JMenuItem();
						jMenu2.add(jMenuItem5);
						jMenuItem5.setText("Nivel 1");
						jMenuItem5.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jMenuItem5ActionPerformed(evt);
							}
						});
					}
					{
						jMenuItem6 = new JMenuItem();
						jMenu2.add(jMenuItem6);
						jMenuItem6.setText("Nivel 2");
						jMenuItem6.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jMenuItem6ActionPerformed(evt);
							}
						});
					}
					{
						jMenuItem7 = new JMenuItem();
						jMenu2.add(jMenuItem7);
						jMenuItem7.setText("Nivel 3");
						jMenuItem7.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jMenuItem7ActionPerformed(evt);
							}
						});
					}
					{
						jMenuItem8 = new JMenuItem();
						jMenu2.add(jMenuItem8);
						jMenuItem8.setText("Nivel 4");
						jMenuItem8.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jMenuItem8ActionPerformed(evt);
							}
						});
					}
				}
				{
					jMenu3 = new JMenu();
					jMenuBar1.add(jMenu3);
					jMenu3.setText("Salir");
				//	jMenu3.addMenuKeyListener(this);
					{
						jMenuItem9 = new JMenuItem();
						jMenu3.add(jMenuItem9);
						jMenuItem9.setText("Salir");
						jMenuItem9.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jMenuItem9ActionPerformed(evt);
							}
						});
					//	jMenuItem9.addMenuKeyListener(this);
					}
				}
				{
					Fondo = new JPanelImagen();
					getContentPane().add(Fondo, BorderLayout.CENTER);
					Fondo.setRutaImagen("/imagenes/images.jpeg");
				}
			}
			
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	private void jMenuItem1ActionPerformed(ActionEvent evt) {
//		VentanaJuego vent = new VentanaJuego();
	//	vent.show();
		//new ControladorPrincipalJuego(10,10,10).getVentanaJuego().setVisible(true);

		
		//TODO add your code for jMenuItem1.actionPerformed
	}
	
	private void jMenuItem9ActionPerformed(ActionEvent evt) {
		System.exit(0);
		//TODO add your code for jMenuItem9.actionPerformed
	}
	
	private void jMenuItem2ActionPerformed(ActionEvent evt) {
		
		//TODO add your code for jMenuItem2.actionPerformed
	}
	
	private void jMenuItem3ActionPerformed(ActionEvent evt) {
		//TODO add your code for jMenuItem3.actionPerformed
	}
	
	private void jMenuItem4ActionPerformed(ActionEvent evt) {
	VentanaPersonalizado ventper = new VentanaPersonalizado();
	ventper.show();
		//TODO add your code for jMenuItem4.actionPerformed
	}
	
	private void jMenuItem5ActionPerformed(ActionEvent evt) {
		VentanaListado ventlis = new VentanaListado();
		ventlis.show();
		//TODO add your code for jMenuItem5.actionPerformed
	}
	
	private void jMenuItem6ActionPerformed(ActionEvent evt) {
		VentanaListado ventlis = new VentanaListado();
		ventlis.show();
		//TODO add your code for jMenuItem6.actionPerformed
	}
	
	private void jMenuItem7ActionPerformed(ActionEvent evt) {
		VentanaListado ventlis = new VentanaListado();
		ventlis.show();
		//TODO add your code for jMenuItem7.actionPerformed
	}
	
	private void jMenuItem8ActionPerformed(ActionEvent evt) {
		VentanaListado ventlis = new VentanaListado();
		ventlis.show();
		//TODO add your code for jMenuItem8.actionPerformed
	}
	public void agregarEsuchador(ActionListener accion)
	{
		jMenuItem1.addActionListener(accion);
		jMenuItem2.addActionListener(accion);
		jMenuItem3.addActionListener(accion);
		jMenuItem4.addActionListener(accion);
		jMenuItem5.addActionListener(accion);
		jMenuItem6.addActionListener(accion);
		jMenuItem7.addActionListener(accion);
		jMenuItem8.addActionListener(accion);
		jMenuItem9.addActionListener(accion);
		
	}

}
